<?php
	require 'page.class.php';
    $connetc=mysql_connect("localhost","root","192510");
	mysql_select_db("news",$connetc);
	
	$sql="select count(*) as amount from wangzhan ";
	$result=mysql_query($sql);
	$row=mysql_fetch_array($result);
	$count=$row['amount'];
	$pagesize=5;
	if($count%$pagesize){
		$page=ceil($count/$pagesize);
	}else{
		$page=$count/$pagesize;
	}
	if(isset($_GET['currentpage'])){
		$currentpage=intval($_GET['currentpage']);
    }else{
		$currentpage=1;
    }
	$start=($currentpage-1)*$pagesize;
    $sql="select * from wangzhan order by id desc limit $start,$pagesize ";
    $result = mysql_query($sql);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="js/select-ui.min.js"></script>
<script type="text/javascript" src="editor/kindeditor.js"></script>
<script type="text/javascript" src="js/jquery-1.6.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="../time/jquery.datetimepicker.css"/>
<script src="../time/jquery.js"></script>
<script src="../time/jquery.datetimepicker.js"></script>
<style>
.tip{
    width:620px;
	height:600px;
}
.tip1{
    width:600px;
	height:600px;
}

</style>
<script type="text/javascript">
 KE.show({
    id : 'content7',
    cssPath : './index.css'
 });
$(document).ready(function(){
  $(".click").click(function(){
  $(".tip").fadeIn(200);
  });
  
  $(".tiptop a").click(function(){
  $(".tip").fadeOut(200);
  });

  $(".tiptop1 a").click(function(){
  $(".tip1").fadeOut(200);
  });
  


});
</script>
<script type="text/javascript">
$(document).ready(function(e) {

	$(".select3").uedSelect({
		width : 152
	});
});
</script>
</head>

<body onload="document.body.scrollTop=document.body.scrollHeight">
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">网站管理</a></li>
    <li><a href="#">网站列表</a></li>
    </ul>
    </div>
    
    <div class="formbody">
	
    <div id="usual1" class="usual">
    <script language="javascript">
	
	$(document).ready(function() 
    { 
    $(".scbtn1").click(function() 
    {      
        if( $(".seachform2").hasClass("hideclass") ) 
        { 
            $(".seachform2").removeClass("hideClass"); 
        } 
        else 
        { 
            $(".seachform2").addClass("hideClass"); 
        }    
    }); 
  }); 
	
	</script>
	
    <script type="text/javascript">
    $(document).ready(function(){
      $(".scbtn1").click(function(){
      $(".seachform2").fadeIn(200);
    }); 
   });
</script>
    <div class="formtitle"><span>项目列表</span></div>
    <div class="tools">
      <ul class="toolbar">
      <li onclick="deletebatch()"><span><img src="images/t03.png"/></span>删除</li>
      </ul>
    </div>
    <table class="tablelist">
    	<thead>
    	<tr>
        <th><input type="checkbox" onclick="selectAll(this)"/></th>
        <th>网站地址</th>
        <th>操作</th>
        </tr>
        </thead>
        <tbody>
		<?php
		 while($row=mysql_fetch_array($result)){
		?>
        <tr>
        <td><input type="checkbox"  name="son_checkbox" value="<?php echo $row['id'];?>"/></td>
        <td><a target="_blank" href="<?php echo $row['link']; ?>"><?php echo $row['name'];?></a></td>

        <td> <a href="delete_web.php?id=<?php echo $row['id'];?>" class="tablelink"> 删除</a></td>
        </tr> 		
		<?php	
			}
		?>
        </tbody>
    </table>
    <div class="pagin">
    	<?php  
    		pagelinks();
    	?>	
    </div>
	</div>
    </div>
</body>
</html>
<script>
      document.write(new Array(100).join("<br>"));
	   
	   
       $('#send_time1').datetimepicker({
		   
			timepicker:false,
			format:'Y-m-d',
	
	   });
	
	
	  $('#send_time2').datetimepicker({
	     timepicker:false,
		 format:'Y-m-d',
	
	  });		
		function new_name(){
		   var title=$("#title").val();
		   if(title==null||title.length==0){
			   $("#yz_title").show();
		   }else{
			    $("#yz_title").hide();
		   }
		   
	   }

		function tijiao(){
		 
		     var title=$("#title").val();
			 if(title==null||title.length==0){
				 alert("新闻名不能为空");
				 return false;
				 
			 }else{
				 
				 return true;
			 }
		   
		   
		   
	   }
	   
       function selectAll(objs){
		   
		     obj=document.getElementsByName('son_checkbox');
			 for(var i=0;i<obj.length;i++){
				 
				 if(objs.checked){
					 obj[i].checked=true;
				 }else{
					 obj[i].checked=false;
				 }
				 
			 }
			 
	   }
	   
	   function deletebatch(){
		   
		   obj=document.getElementsByName('son_checkbox');
		   var arrayid=new Array();
		   for(var i=0;i<obj.length;i++){
			   
			   if(obj[i].checked){
				  
				  arrayid.push(obj[i].value);
				  
			   }
		   }
		   
		   if(arrayid.length==0){
			   
			   alert("请选择需要删除的任务");
			   
		   }else{
			   
			   
			   if(confirm("确定要删除所选择的网址吗")){
				  
				  $.post('delete_web.php',{arrayid:arrayid},function(data){
					window.location.reload();
			      });
				  
			  }else{
				  return false;
			  }
			   
			   
		   }
			   
	   }
	   
</script>
